<!DOCTYPE html>
<html>
<head>
<script>
function runTest()
{
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.dumpChildFrames();
    }
    body = document.getElementById('body');
    frame1 = document.getElementById('frame1');
    body.removeChild(frame1);

    // Below we effectively execute (pseudo-code):
    //   window.name = "same name as before"
    // This shouldn't trigger a recalculation of unique name (which can result
    // in a different unique name, because right now there is no frame1 with
    // a conflicting window.name=="foo").
    frame2 = document.getElementById('frame2');
    frame2.contentWindow.name = "foo";

    // Before fixes, this test used to trigger a DCHECK in
    // void FrameTreeNode::SetFrameName(...) {
    //   if (name == replication_state_.name) {
    //     // |unique_name| shouldn't change unless |name| changes.
    //     DCHECK_EQ(unique_name, replication_state_.unique_name);
    //     return;
    //   }
}
</script>
</head>
<body onload="runTest()" id="body">
<iframe name="foo" id="frame1"></iframe>
<iframe name="foo" id="frame2"></iframe>
</body>
</html>
